@@ -1,5 +1,11 @@
Revision history for MooseX-Workers
+0.15 2011-02-01
+ - CPAN testers looks happy so pushing as 0.15.
+
+0.14_01 2011-02-01 David K. Storrs
+ - MXW now saves its ctor-time params so they can be passed on to Engine later
+
0.14 2010-11-16
- Oops. DateTime is a new dep from David's new test.
@@ -34,4 +34,8 @@ t/40.worker.stderr_filter.line.t
t/41.worker.stderr_filter.reference.t
t/50.consolidate.worker.results.t
t/60.pass.object.from.child.t
+t/61.set.max_workers.at.ctor.time.t
+t/62.set.max_workers.at.run.time.t
+t/lib/BaseClass.pm
+t/lib/BaseClass/Subclass.pm
t/synopsis.pl
@@ -8,7 +8,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
-generated_by: 'Module::Install version 0.99'
+generated_by: 'Module::Install version 1.00'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -22,8 +22,7 @@ requires:
DateTime: 0
Moose: 0.90
POE: 1.004
- Test::More: 0.42
resources:
license: http://dev.perl.org/licenses/
- repository: git://github.com/jhannah/moosex-workers.git
-version: 0.14
+ repository: git://github.com/jhannah/moosex-workers
+version: 0.15
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -48,6 +48,14 @@ sub auto_install {
while (my ($mod, $ver) = splice(@requires, 0, 2)) {
$seen{$mod}{$ver}++;
}
+ my @build_requires = map @$_, map @$_, grep ref, $self->build_requires;
+ while (my ($mod, $ver) = splice(@build_requires, 0, 2)) {
+ $seen{$mod}{$ver}++;
+ }
+ my @configure_requires = map @$_, map @$_, grep ref, $self->configure_requires;
+ while (my ($mod, $ver) = splice(@configure_requires, 0, 2)) {
+ $seen{$mod}{$ver}++;
+ }
my @deduped;
while (my ($mod, $ver) = splice(@features_require, 0, 2)) {
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
}
# Suspend handler for "redefined" warnings
@@ -9,7 +9,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.99';
+ $VERSION = '1.00';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '0.99';
+ $VERSION = '1.00';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -230,8 +230,12 @@ sub preload {
sub new {
my ($class, %args) = @_;
- delete $INC{'FindBin.pm'};
- require FindBin;
+ delete $INC{'FindBin.pm'};
+ {
+ # to suppress the redefine warning
+ local $SIG{__WARN__} = sub {};
+ require FindBin;
+ }
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
@@ -1,16 +1,32 @@
package MooseX::Workers;
use Moose::Role;
use MooseX::Workers::Job;
-our $VERSION = '0.14'; # http://www.cpan.org/modules/04pause.html - Developer releases
+our $VERSION = '0.15'; # http://www.cpan.org/modules/04pause.html - Developer releases
use MooseX::Workers::Engine;
+has _ctor_params => (
+ is => 'ro',
+ isa => 'HashRef',
+ lazy => 1,
+ default => sub { {} },
+);
+
+around BUILDARGS => sub {
+ my ($orig, $class, %args) = @_;
+
+ shift;
+ shift;
+
+ return $class->$orig( _ctor_params => \%args, @_ );
+};
+
has Engine => (
isa => 'MooseX::Workers::Engine',
is => 'ro',
lazy => 1,
required => 1,
- default => sub { MooseX::Workers::Engine->new( visitor => $_[0] ) },
+ builder => '_build_Engine',
handles => [
qw(
max_workers
@@ -22,6 +38,12 @@ has Engine => (
)
],
);
+sub _build_Engine {
+ my $self = shift;
+ my @args;
+ push @args, max_workers => $self->_ctor_params->{max_workers} if exists $self->_ctor_params->{max_workers};
+ MooseX::Workers::Engine->new( visitor => $self, @args );
+}
sub spawn {
my ( $self, $cmd, $args ) = @_;
@@ -0,0 +1,9 @@
+use Test::More tests => 2;
+use lib qw(lib t/lib);
+use BaseClass::Subclass;
+
+sub make_man { BaseClass::Subclass->new( @_ ) }
+
+is( make_man()->max_workers, 20, "Should default to 20 max_workers when no value specified" );
+is( make_man( max_workers => 10 )->max_workers, 10, "Should have 10 max_workers when so specified" );
+
@@ -0,0 +1,14 @@
+use Test::More tests => 2;
+use lib qw(lib t/lib);
+use BaseClass::Subclass;
+
+sub make_man { BaseClass::Subclass->new( @_ ) }
+
+my $man = make_man(max_workers => 10);
+
+is( make_man( max_workers => 10 )->max_workers, 10, "At construction time, it respected the max_workers param" );
+
+$man->max_workers( 20 );
+
+is( $man->max_workers, 20, "Can reset the max_workers param at run time" );
+
@@ -0,0 +1,9 @@
+package BaseClass::Subclass;
+
+use strict;
+use warnings;
+use Moose;
+
+extends 'BaseClass';
+
+1;
@@ -0,0 +1,20 @@
+package BaseClass;
+
+use strict;
+use warnings;
+use Moose;
+
+with qw(MooseX::Workers);
+
+around BUILDARGS => sub {
+ my $orig = shift;
+ my $class = shift;
+
+ my %args = @_;
+
+ $args{max_workers} = 20 unless exists $args{max_workers};
+
+ return $class->$orig( %args );
+};
+
+1;